package jacob;

import java.util.Iterator;
import java.util.List;

import com.idTech.iDTechModBaseJacob;

import net.minecraft.entity.Entity;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIBreakDoor;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAIMoveTowardsTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.item.EntityExpBottle;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPotion;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

public class Healer extends EntityMob{

    public Healer(World par1World) {
            super(par1World);
            this.texture = "/mods/iDTechModBase/textures/Healer.png";
            this.moveSpeed = 0.30F;
            this.tasks.addTask(0, new EntityAISwimming(this));
	    this.tasks.addTask(1, new EntityAIBreakDoor(this));
	    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false));
	    this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
	    this.tasks.addTask(4, new EntityAIWander(this, this.moveSpeed));
	    //this.tasks.addTask(5, new EntityAIMoveTowardsTarget(this,  EntityPlayer.class, 12));
	    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    }
   
    public int getAttackStrength(Entity par1Entity)
{
return 6;
}
   
    protected boolean isAIEnabled()
{
    return true;
}

    public int getMaxHealth() 
    {
            return 50;
    }
   
     public String getTexture()
    {
    	 return "/mods/iDTechModBase/textures/Healer.png";
    }

    public int getTotalArmorValue()
    {
        return 8;
    }

    protected String getLivingSound()
    {
        return "mob.zombie.say";
    }

    protected String getHurtSound()
    {
        return "mob.zombie.hurt";
    }
   
    protected String getDeathSound()
    {
        return "mob.zombie.death";
    }
   
    protected void playStepSound(int par1, int par2, int par3, int par4)
    {
        this.worldObj.playSoundAtEntity(this, "mob.zombie.step", 0.15F, 1.0F);
    }
    
    /**
     * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
     * use this to react to sunlight and start to burn.
     */
    public void onLivingUpdate()
    {
        if (!this.worldObj.isRemote)
        {
            ticks++;
            
            if ((ticks + nextThrowTick) %150 == 0)
            {
            	nextThrowTick = (int)(Math.random() * 75);
            //	ItemStack healPotion = new ItemStack(new Item.po);
            //	ItemPotion potion = new ItemPotion(par1)
            // +2 is instant damage
            // +4 is invisability
            // +7 is regeneration
            // +8 is speed
            // +9 is fire resistance
            // +10 is poison
            // +11 is instant health
            // +12 is night vision
            // +14 is weakness
            // +15 is strength
            // +16 is slowness
            // +18 is instant damage
            // +20 is invisability 
            // +23 is regeration 2
            // +24 is speed 2
            // +31 is strength 2
            	this.worldObj.spawnEntityInWorld(new EntityPotion(this.worldObj, this, Potion.regeneration.id + 23));
            	this.worldObj.spawnEntityInWorld(new EntityPotion(this.worldObj, this, Potion.regeneration.id + 24));
            	this.worldObj.spawnEntityInWorld(new EntityPotion(this.worldObj, this, Potion.regeneration.id + 31));
            }
           
        }

        super.onLivingUpdate();
    }
    
    private int ticks = 0;
    private int nextThrowTick = 20;
    

}


